Week 4 - Embedded Programming
Group Assignment
In our group assignment we compared the performance and development workflows for 3 different boards :
- XIAO PR2040
- Arduino Uno
- Node MCU v3
here is the group assignment link for more details https://fabacademy.org/2023/labs/egypt/group-assignments.html#4 What I have learned so far ?
- RP2040 Tech Specifications
Dual-core Arm Cortex-M0+ processor, flexible clock running up to 133 MHz
2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels
1 × USB 1.1 controller and PHY, with host and device support
8 × Programmable I/O (PIO) state machines for custom peripheral support
Supported input power 1.8–5.5V DC
Operating temperature -40°C to +85°C
- XIAO RP2040 Specifications
Seeed Studio XIAO RP2040 is compatible with the Raspberry Pi RP2040 ecosystem
as they share the same RP2040 chip. It supports multiple languages including C / MicroPython
Features: High Performance: Powered by Raspberry Pi 2040 chip, dual-core operating up to 133 MHz
Ultra-small Design: 21 x 17.5mm
Multiple Development Interfaces: 2x buttons, 11x digital I/O , 4x analog pins
- Setup Process Of RP2040 On Arduino IDE
- Launch the Arduino application.
- Navigate to File > Preferences, and fill Additional Boards Manager URLs with the url below: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
- Navigate to Tools-> Board-> Boards Manager. type the keyword "RP2040 " in the searching blank. Select the latest version of "Raspberry Pi Pico/RP2040" and install it.
Individual Assignment
Hello Echo in Arduino
- find the code on the website http://academy.cba.mit.edu/classes/embedded_programming/RP2040/hello.RP2040-XIAO.blink-echo.ino
//
// hello.RP204-XIAO.blink-echo.ino
//
// Seeed XIAO RP2040 blink and echo hello-world
//
// Neil Gershenfeld 2/12/23
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//
#include <Adafruit_NeoPixel.h>
//
// globals
//
#define numpixels 1
#define pixelpower 11
#define pixelpin 12
#define bufsize 25
char buf[bufsize];
int count=0;
//
// setup
//
Adafruit_NeoPixel pixel(numpixels,pixelpin,NEO_GRB+NEO_KHZ800);
void setup() {
Serial.begin();
pixel.begin();
pinMode(pixelpower,OUTPUT);
digitalWrite(pixelpower,HIGH);
}
//
// main loop
//
void loop() {
char chr;
//
// check for a char
//
if (Serial.available()) {
//
// read, save, and send char
//
chr = Serial.read();
buf[count] = chr;
count += 1;
buf[count] = 0;
if (count == (bufsize-1))
count = 0;
Serial.print("hello.RP2040-XIAO.blink-echo.ino: you typed ");
Serial.println(buf);
//
// blink LED red green blue white black
//
pixel.setPixelColor(0,pixel.Color(255,0,0));
pixel.show();
delay(100);
//
pixel.setPixelColor(0,pixel.Color(0,255,0));
pixel.show();
delay(100);
//
pixel.setPixelColor(0,pixel.Color(0,0,255));
pixel.show();
delay(100);
//
pixel.setPixelColor(0,pixel.Color(255,255,255));
pixel.show();
delay(100);
//
pixel.setPixelColor(0,pixel.Color(0,0,0));
pixel.show();
pixel.show();
}
}
- Select the board and the port
- upload/ burn the code and open the serial monitor
Blink Internal LED in Arduino
- Open the Blink example by navigating "File → Examples --->01.Basics → Blink"
- Select the board and the port
- upload/ burn the code
Blink external LED with Button in Arduino
Code Files